/**
 * Dear programmer:
 * When I wrote this code, only god and I knew how it worked.
 * Now, only god knows it!
 *
 * @author: lyl  Date: 2019-03-08 Time: 13:47
 */
import {PersonnelStatus_Filters,RetrieveJqGrid} from "./Actions"
import {FetchStatus} from "../../../../../configuration/RequestConfiguration";

export const onPersonnelStatus_Filters = (state = {}, action) => {
    switch (action.type) {
        case PersonnelStatus_Filters:{
            switch (action.status) {
                case FetchStatus.Start: {
                    return {...state, fetchStatus: action.status}
                }
                case FetchStatus.Success: {
                    return {...action.json, fetchStatus: action.status,workStatus:action.workStatus,departMent:action.departMent}
                }
                default: {
                    return {...state, fetchStatus: action.status,workStatus:action.workStatus,departMent:action.departMent}
                }
            }
        }
    }
    return state;
}

export const onGetRoomService = (state = {}, action) => {
    switch (action.type) {
        case RetrieveJqGrid:{
            switch (action.status) {
                case FetchStatus.Start: {
                    return {...state, fetchStatus: action.status}
                }
                case FetchStatus.Success: {
                    return {...action.json, fetchStatus: action.status,workStatus:action.workStatus,departMent:action.departMent}
                }
                default: {
                    return {...state, fetchStatus: action.status,workStatus:action.workStatus,departMent:action.departMent}
                }
            }
        }
    }
    return state;
}